<template>
  <div>
    <div class="xq">
      <el-container>
        <el-page-header @back="goBack"> </el-page-header>
        <el-header class="zt"> 传智健康 </el-header>
      </el-container>
    </div>

    <div class="miageA1">
      <img
        class="demo-image__lazy2"
        src="../../assets/widget-detail.png"
        width="100%"
        height="160%"
      /><img />
    </div>

    <div class="project-text">
      <h4 class="tit">{{ ListArr[0][1].namesk }}</h4>
      <p class="subtit">该套餐共23项检查项</p>
      <el-tag type="danger" disabled size="medium" class="q4"
        ><i class="el-icon-user-solid">{{
          ListArr[0][0].sex == 0
            ? "女"
            : ListArr[0][0].sex == 1
            ? "男"
            : "男女单人"
        }}</i></el-tag
      >
      <el-tag type="danger" disabled size="medium" class="q5"
        ><i class="el-icon-s-custom"
          >{{ ListArr[0][1].minage }}---{{ ListArr[0][1].maxage }}</i
        ></el-tag
      >
    </div>
    <!-- 预约须知与套餐详情区 -->
    <div class="project-know">
              <router-link to="/OrderNotes" style="text-decoration: none">
                <el-card class="box-card" style="height: 90px; width: 100%">
                  <span style="color: aliceblue">卡片名称</span>
                  <div style="float: right"><i class="el-icon-arrow-right"></i></div>
                  <el-tag
                    style="float: left; padding: 3px 0; position: relative; top: 7px"
                    type="text"
                    ><h2>预约须知</h2></el-tag>
                </el-card>
              </router-link>
              <div class="bgA"></div>
        <div class="mainA">
                  <div class="tcxq">
                    <span style="float: left"><h3>套餐详情</h3></span>
                  </div>
                  <div class="bgA2"></div>

                  <div>
                      <!-- 项目 内容 详情解读的弹出框  -- 预约须知与套餐详情区  -->
                      <template class="tbA">
                        <el-table :data="checkgroObjkB" style="width: 100%">
                          <el-table-column
                            dispaly="dispaly"
                            prop="checkgroupId"
                            label=""
                            width="70"
                          >
                          </el-table-column>
                          <el-table-column prop="name" label="项目名称" width="700">
                          </el-table-column>
                          <el-table-column prop="attention" label="项目解读" width="700">
                          </el-table-column>
                          <el-table-column prop="ChaoZuo" label="项目详情解读">
                            <template slot-scope="scope">
                              <el-popover placement="right" width="200" trigger="click" >
                                <el-table :data="checkgroObjkC">
                                  <el-table-column
                                    width="100"
                                    property="name"
                                    label="项目内容"
                                  ></el-table-column>
                                </el-table>
                                <el-button slot="reference" type="primary"  @click="xqjd(scope.row)">项目内容解读</el-button>
                              </el-popover>
                            </template>
                          </el-table-column>
                        </el-table>
                      </template>
                  </div>
          </div>    
        <!-- 立即预约 区 -->
        <!-- <router-link to="/LoginView" style="text-decoration: none">
          <div class="bgB">
            <span style="position: relative; top: 38px"><h1>立即预约</h1></span>
          </div>
        </router-link> UserInfoSubmit-->
       
              <div class="bgB"><span style="position:relative;top:38px;">
               <el-button type="primary" @click="dialogFormVisible = true"><h1>立即预约</h1></el-button> 
                </span></div>
      
        <el-dialog title="体检人信息" :visible.sync="dialogFormVisible">
           <el-form :model="UserInfo" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
            <el-form-item label="体检人" prop="name">
                <el-input v-model="UserInfo.name"></el-input>
            </el-form-item>
            <el-form-item label="性别" prop="resource">
                <el-radio-group v-model="UserInfo.sex">
                <el-radio label="男"></el-radio>
                <el-radio label="女"></el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="手机号" prop="name">
                <el-input v-model="UserInfo.phone"></el-input>
            </el-form-item>
             <el-form-item label="身份证号" prop="name">
                <el-input v-model="UserInfo.cardID"></el-input>
            </el-form-item>
            <el-form-item label="出生日期" required>
                <el-col :span="11">
                <el-form-item prop="date1">
                    <el-date-picker type="date" placeholder="选择日期" v-model="UserInfo.date1" style="width: 100%;"></el-date-picker>
                </el-form-item>
                </el-col>
            </el-form-item>
            <!-- <el-form-item label="性别" prop="resource">
                <el-radio-group v-model="UserInfo.sex">
                <el-radio label="男"></el-radio>
                <el-radio label="女"></el-radio>
                </el-radio-group>
            </el-form-item> -->
            <el-form-item>
                <el-button type="primary" @click="submitForm('UserInfo')">立即创建</el-button>
                <el-button @click="resetForm('UserInfo')">重置</el-button>
            </el-form-item>
            </el-form>
<!-- 
          <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
          </div> -->
        </el-dialog>
          
    </div>

    <!-- 提交预约人信息 -->
    <!-- <div class="InfoUser">
      
    </div> -->
  </div>
</template>
<script>
import Vue from "vue";
import axios from "axios";
import VueAxios from "vue-axios";
Vue.use(VueAxios, axios);
export default {
  data() {
    return {
      listresdataA: [],
      ListArr: [],
      checkgroObjkB: [], //项目
      checkgroObjkC: [], //项目内容
      dialogFormVisible: false,
      formLabelWidth: '120px',
      UserInfo:[], //预约人信息提交

      rules: {
          name: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '请选择活动区域', trigger: 'change' }
          ],
          date1: [
            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          ],
          date2: [
            { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
          ],
          type: [
            { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
          ],
          resource: [
            { required: true, message: '请选择活动资源', trigger: 'change' }
          ],
          desc: [
            { required: true, message: '请填写活动形式', trigger: 'blur' }
          ]
        }
    };
  },
  methods: {
    //拿到项目名称与介绍
    loadB() {
      this.axios
        .post(
          "/abb/TSetmealCheckgroupController/allGroupBycheckgroupId/" +
            this.ListArr[0][0].id
        )
        .then((res) => {
          this.checkgroObjkB = res.data;
        });
    }, //拿到项目内容
    xqjd(scope) {
      console.log("Id详情拿取" + scope.id);
      let checkgroupId=scope.id;
      this.axios.post( "/abb/TCheckgroupCheckitemController/allitemBygroupId/" +checkgroupId)
        .then((res) => {
          this.checkgroObjkC = res.data;
        });
    },
    goBack() {
      // this.$router.go(-1)
    },
  },
  created() {
    this.listresdataA = this.$route.query.value;
    let aa = JSON.parse(this.listresdataA);
    // console.log(aa)
    let arr = []; //二维数组
    aa.forEach((element) => {
      let arr1 = [];
      element.tCheckgroup.forEach((res1) => {
        arr1.push(res1);
      });
      element.tSetmeal.forEach((res2) => {
        arr1.push(res2);
      });
      arr.push(arr1);
    });
    this.ListArr = arr;
    //console.log(this.ListArr[0][0].id)
    this.loadB();
  },
};
</script>

<style scoped>
.xq {
  background-color: black;
  color: aliceblue;
  text-align: center;
  height: 40px;
}
.miageA1 {
  width: 100%;
  height: 400px;
}
.project-text {
  position: absolute;
  top: 720px;
}
.q4 {
  position: relative;
  left: -14px;
  top: 20px;
}
.q5 {
  position: relative;
  left: 20px;
  top: 20px;
}
.project-know {
  position: relative;
  left: 0px;
  top: 400px;
}
.bgA {
  background-color: gainsboro;
  height: 30px;
  display: flex;
  justify-content: start;
  margin-top: 0px;
}
.tcxq {
  position: relative;
  top: 35px;
  left: 20px;
  height: 60px;
}
.bgA2{
    background-color: gainsboro;
    height: 30px;
    margin-top: 30px;
}
.bgB {
  background-color: rgb(125, 160, 254);
  color: white;
  height: 120px;
  position: relative;
   margin-top: 120px;
}
</style>
